home *** CD-ROM | disk | FTP | other *** search
- /* MainWindow.c */
- /* Created 3/13/4 1:08 PM by AppMaker */
-
-
- #include "Globals.h"
- #include "ResourceDefs.h"
- #include "Scrolling.h"
- #include "WindowAids.h"
- #include "Miscellany.h"
-
- #include "MainWindow.h"
-
-
- #define NIL 0L
-
- /*----------*/
- void OpenMainWindow (fName, vRefNum, fRefNum)
- Str255 fName;
- short vRefNum;
- short fRefNum;
- {
- WindowPtr newWindow;
- Rect bounds;
-
- newWindow = GetNewWindow (MainWindowID, nil, (WindowPtr) -1L);
- //SetWTitle (newWindow, fName);
- SetPort (newWindow);
- SetNewInfo (newWindow);
- cur->vScroll = nil;
- cur->hScroll = nil;
- cur->PasswordHandle = GetNewControl (128, newWindow);
- SetRect (&bounds, 44, 224, 200, 240);
- cur->Field2Handle = TENew (&bounds, &bounds);
- TEAutoView (true, cur->Field2Handle);
- cur->AllowRemoteWarmHandle = GetNewControl (132, newWindow);
- cur->Slider10Handle = GetNewControl (133, newWindow);
- cur->text = cur->Field2Handle;
- cur->fileNum = fRefNum;
- cur->volNum = vRefNum;
- cur->dirty = false;
- cur->filename = NewString (fName);
- cur->windowKind = WMainWindow;
-
- ShowWindow (newWindow);
-
- } /*OpenMainWindow*/
-
- /*----------*/
- void CloseMainWindow ()
- {
- TEDispose (cur->Field2Handle);
-
- DisposHandle ((Handle) cur->filename);
- DiscardInfo (curWindow);
- } /*CloseMainWindow*/
-
- /*----------*/
- void MouseInMainWindow (where, modifiers)
- Point where;
- short modifiers;
- {
- Rect bounds;
-
- if (PtInRect (where, &(**(cur->Field2Handle)).viewRect)) {
- if (cur->text != nil) {
- TEDeactivate (cur->text);
- }
- cur->text = cur->Field2Handle;
- TEActivate (cur->text);
- TEClick (where, false, cur->text);
- }
- } /*MouseInMainWindow*/
-
- /*----------*/
- void TypeInMainWindow (ch)
- char ch;
- {
- if (cur->text == nil) {
- SysBeep (1);
- } else {
- TEKey (ch, cur->text);
- }
- } /*TypeInMainWindow*/
-
- /*----------*/
- void UpdateMainWindow ()
- {
- Rect bounds;
-
- TEUpdate (&thePort->portRect, cur->Field2Handle);
- SetRect (&bounds, 40, 76, 89, 126);
- DrawPictureID (129, bounds);
- SetRect (&bounds, 40, 128, 88, 160);
- TextIDBox (128, bounds);
- SetRect (&bounds, 128, 68, 192, 164);
- FrameRect (&bounds);
- SetRect (&bounds, 28, 68, 96, 164);
- FrameRect (&bounds);
- SetRect (&bounds, 12, 12, 168, 40);
- DrawPictureID (133, bounds);
- SetRect (&bounds, 96, 40, 198, 54);
- DrawPictureID (132, bounds);
- SetRect (&bounds, 156, 80, 187, 138);
- DrawPictureID (130, bounds);
- } /*UpdateMainWindow*/
-
- /*----------*/
- void ActivateMainWindow (activate)
- Boolean activate;
- {
- HiliteScroll (cur->Slider10Handle, activate);
- } /*ActivateMainWindow*/
-
- /*----------*/
- void ResizeMainWindow ()
- {
- /* application-specific code to resize items in window */
- } /*ResizeMainWindow*/
-
- /*----------*/
- pascal void ScrollMainWindow (newValue, oldValue)
- short newValue;
- short oldValue;
- {
- /* application-specific code to scroll window */
- } /*ScrollMainWindow*/
-
- /*----------*/
- void ControlMainWindow (whichControl, whichPart, where)
- ControlHandle whichControl;
- short whichPart;
- Point where;
- {
- Rect bounds;
-
- if (whichControl == cur->PasswordHandle) {
- TrackCheck (cur->PasswordHandle, where, &cur->PasswordChecked);
- }
- if (whichControl == cur->AllowRemoteWarmHandle) {
- TrackCheck (cur->AllowRemoteWarmHandle, where, &cur->AllowRemoteWarmChecked);
- }
- if (whichControl == cur->Slider10Handle) {
- TrackScroll (cur->Slider10Handle, whichPart, where, nil);
- }
- } /*ControlMainWindow*/
-
- /* MainWindow */
-